<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>更新提示</title>
    <!-- 基本框架 -->
    <link rel="stylesheet" href="../../../css/common.css">
    <script src="../../../script/vue.min.js" type="text/javascript"></script>
    <script src="../../../script/frame.js" type="text/javascript"></script>
    <script src="../../../script/baseConfig.js" type="text/javascript"></script>
    <script src="../../../script/utils.js" type="text/javascript"></script>
    <script src="../../../script/common.js" type="text/javascript"></script>
    <style>
        body{
            background:rgba(0,0,0,0);
        }
        .layerContent{
            position:fixed;
            top:50%;
            left:50%;
            transform: translate(-50%,-50%);
            width:80%;
            z-index:1000;
            background:#FFF;
            border-radius:0.23rem;
        }
        .layerContent .updateBg{
            display: block;
            width:100%;
        }
        .layerContent ._c{
            padding:0 0.5rem;
            margin:0.4rem 0;
            -webkit-overflow-scrolling: touch;
            overflow-y:auto;
            max-height:5rem;
        }
        .layerContent ._c ._title1{
            color:#181818;
            font-weight:normal;
            line-height:0.5rem;
            font-size:0.31rem;
        }
        .layerContent ._c ._title2{
            color:#181818;
            font-weight:bold;
            line-height:0.5rem;
            margin-top:0.3rem;
            font-size:0.31rem;
        }
        .layerContent ._c ._text{
            margin-top:0.15rem;
            line-height:0.55rem;
			color:#727272;
			font-size:0.29rem;
			word-wrap:break-word;
        }
        .layerContent .btn{
            padding:0 0.5rem 0.5rem 0.5rem;
        }
        .layerContent .btn button{
            float:left;
            height:0.7rem;
            line-height:calc(0.7rem - 2px);
            border:1px solid #F4F4F4;
            color:#727272;
            width:calc((100% - 0.3rem) / 2);
            font-size:0.29rem;
            border-radius:3px;
        }
        .layerContent .btn button._up{
            margin-left:0.3rem;
            border:1px solid #FF6F41!important;
            color:#FFF;
            background:#FF6F41;
        }
    </style>
</head>
<body>
    <div id="app" v-cloak>
        <div id="container">
            <div class="shadow"></div>
            <div class="layerContent">
                <img src="../../../image/home/updateBg.png" class="updateBg">
                <div class="_c">
                    <h3 class="_title1">尊敬的用户，平台已更新新版本内容，请及时更新体验</h3>
                    <h3 class="_title2">· 主要更新内容有：</h3>
                    <div class="_text" v-html="result.updateTip || '优化APP体验'"></div>
                </div>
                <div class="btn clearfix">
                    <template v-if="!result.closed">
                        <button @click="api.closeFrame();">取消</button>
                        <button class="_up" @click="update()">更新</button>
                    </template>
                    <template v-else>
                        <!--后台若是强制更新的话就用这个-->
                        <button class="_up" @click="update()" style="margin-left:0;width:100%;border:0;height:0.8rem;line-height:calc(0.8rem - 2px);">立即更新</button>
                    </template>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        apiready = function() {
            var app = new Vue({
                el:'#app',
                data:{
					iosTest:false,
					result:api.pageParam
                },
                methods:{
					update(){
						var that = this;
						//api.setFrameAttr({name: 'updateLayer',hidden: true});
						
						if (api.systemType == "android") {
						    api.download({
								url : that.result.source,
								report : true,
								cache:false,
							}, function(ret, err) {
								if (ret && 0 == ret.state) {/* 下载进度 */
									$.showLoad({
										text:"正在下载" + ret.percent + "%"
									});
								}
								if (ret && 1 == ret.state) {/* 下载完成 */
									var savePath = ret.savePath;
									api.installApp({
										appUri : savePath
									});
									$.hideLoad();
								}
								if (ret && 2 == ret.state) {/* 下载失败 */
									$.toast("下载失败，网络错误。");
								}
							});
						}
						if (api.systemType == "ios") {
						    api.installApp({
						        appUri : that.result.source
						    });
						}
					}
                },
                mounted(){
					$.initJs(this);
                }
            });
			
			api.setFrameAttr({
			    name: 'notice',
			    hidden: true
			});
        }
    </script>
</body>
</html>
